import User.AdminUser;
import User.NormalUser;
import User.User;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-12-31
 * Time: 21:40
 */
public class Test {
    public static User login(){
        System.out.println("请输入你的姓名:");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("请输入你的身份");
        System.out.println("1:管理员,0:普通用户");
        int choice =scanner.nextInt();
        if(choice==1){
          return   new AdminUser(name);
        }else{while (true)
          return   new NormalUser(name);
        }

    }
    public static void main(String[] args) {
        User user=login();
        BookList bookList = new BookList();
        while(true) {
            int choice = user.menu();
            //根据你菜单返回的choice来执行对应的操作
            user.doOperation(choice, bookList);

        }
    }
}

